package errors

const (
	SuccessCode        = 1   //SuccessCode  请求成功,返回正常数据
	ErrorCode          = -1  //ErrorCode 请求成功,出错了
	FailureCode        = -1  //FailureCode 失败码
	NotLogin           = 401 //请先登录
	AuthorizationError = 403 //暂无访问权限
	NotFound           = 404
	ServerError        = 500 //ServerError 服务异常
)

type ErrorMsg struct {
	Language string
}

func NewErrorMsg(language string) *ErrorMsg {
	language = "zh_CN"
	return &ErrorMsg{
		Language: language,
	}
}
func (em *ErrorMsg) Text(code int) (str string) {
	var ok bool
	switch em.Language {
	case "zh_CN":
		str, ok = zhCNText[code]
	case "en":
		str, ok = enUSText[code]
	default:
		str, ok = zhCNText[code]
	}
	if !ok {
		return "unknown error"
	}
	return
}
